package my.food.controller;

import com.baomidou.mybatisplus.extension.api.R;
import my.food.bean.Result;
import my.food.entity.Comment;
import my.food.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2024-05-19
 * Time: 12:56
 */

@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private ICommentService commentService;

    @GetMapping("list")
    public List<Comment> list() {
        List<Comment> commentList = new ArrayList<>();
        try {
            commentList = commentService.commentList();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return commentList;
    }

}
